import Vue from 'vue'
import Home from "@/views/Home"
import Search from "@/views/Search"
import NotFound from "@/views/NotFound"


import VueRouter from 'vue-router'
Vue.use(VueRouter)
const router = new VueRouter({
  routes: [
    // 当访问 / 这个路径的时候 会自动跳转到home
    { path: '/', redirect: '/home' },
    { path: '/home', component: Home },
    // 动态路由 words就是参数
    // 可选符? 表示 动态路由后面的参数 可传 可不传
    { path: '/search/:words?', component: Search },
    // 404的配置 一般配置在路由的最后
    { path: '*', component: NotFound }
  ]
})

export default router